var express = require('express');
var router = express.Router();
var APIS = require('../api');

/* GET users listing. */

var LogAPI = APIS.Log;
var UserAPI = APIS.User;

router.get('/logs', LogAPI.getList);
router.post('/logs', LogAPI.post);
router.put('/logs/:_id', LogAPI.put);
router.delete('/logs/:_id', LogAPI.delete);

router.get('/users', UserAPI.list);

var SatisticsAPI = APIS.Satistics;
router.get('/satistics/totalHours', SatisticsAPI.totalHours)
router.get('/satistics/currentUser',SatisticsAPI.currentUser)


//get current user
router.get('/user', function(req, res, next) {
        if (!req.session.user) {
            res.status(404);
            res.end();
        } else {
            res.json(req.session.user);
        }
    }
);



module.exports = router;
